plane Derived Type

type, public :: plane

Defines a plane as .


Contents


Components

Type Visibility Attributes Name Initial
real(kind=real64), public :: a

The x-component of the plane normal vector.

real(kind=real64), public :: b

The y-component of the plane normal vector.

real(kind=real64), public :: c

The z-component of the plane normal vector.

real(kind=real64), public :: d

The offset from the origin.


Constructor

public interface plane

  • private pure function plane_from_3pts(pt1, pt2, pt3) result(rst)

    Constructs a plane from 3 points. The 3 points must not be colinear.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: pt1(3)

    The first point.

    real(kind=real64), intent(in) :: pt2(3)

    The second point.

    real(kind=real64), intent(in) :: pt3(3)

    The third point.

    Return Value type(plane)

    The resulting plane.

  • private pure function plane_from_point_and_normal(pt, nrm) result(rst)

    Constructs a plane from a point which lies on the plane, and a unit vector normal to the plane.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in) :: pt(3)

    The point that lies on the plane.

    real(kind=real64), intent(in) :: nrm(3)

    The normal unit vector.

    Return Value type(plane)

    The resulting plane.

  • private pure function plane_from_many_points(pts) result(rst)

    Constructs the plane that best fits a cloud of points in a least-squares sense.

    Arguments

    Type IntentOptional Attributes Name
    real(kind=real64), intent(in), dimension(:,:) :: pts

    The N-by-3 matrix containing the N points to fit. N must be at least 3, but is typically much larger.

    Return Value type(plane)

    The resulting plane.


Type-Bound Procedures

procedure, public :: flip_normal => plane_flip_normal

  • private subroutine plane_flip_normal(this)

    Flips the normal vector of the plane.

    Arguments

    Type IntentOptional Attributes Name
    class(plane), intent(inout) :: this

    The plane.